package utils;

import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.List;

/**
 * 查询工具
 * @author Administrator
 *
 */
public class QueryUtil {
	

	/**
	 * 获取当前查询的总记录数
	 * @param em
	 * @return
	 */
	public static int  getQueryCount(EntityManager em){
		int count = 0;
		Query queryCount = em.createNativeQuery("select FOUND_ROWS() as result");
		count = Integer.parseInt(queryCount.getResultList().get(0).toString());
		return count;
	}
}
